<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
	$(function(){
		$("#chkToggle").click(function(){
			var elements = $("form :checkbox");
			if(this.checked){
				elements.each(function(element){
					this.checked = true;
					document.forms[0].hndBoxChecked.value ++;
				});
			}else{
				elements.each(function(element){
					this.checked = false;
				});
				document.forms[0].hndBoxChecked.value = 0;
			}
		});

        $("#lnkSaveHistory").click(function(){
            if(confirm('Bạn có chắc muốn chốt doanh số!?')){
                window.location = '<?php echo DOMAIN?>/incomes/saveHistory';
            }
        }); 
		
        $("#lnkConfig").click(function(){
    		window.location = '<?php echo DOMAIN?>/incomes/config';
        }); 
		
		$("#lnkClose").click(function(){
			window.location = '<?php echo DOMAIN?>/home';
		});	
		
		$("#btnFilter").click(function(){
			document.adminForm.submit();
		});

		$("#btnReset").click(function(){
			$("#hndResetFilter").val(1);
			document.adminForm.submit();
		});
	});

	function isChecked(checkObject){
		if (checkObject.checked == true){
			document.adminForm.hndBoxChecked.value ++;
		}else {
			document.adminForm.hndBoxChecked.value --;
		}
	}

	function getSelectedID(){
		var IDs = "";
		$('input[name=chkID]:checkbox').each(function(){
			if(this.checked){
				if(IDs.isEmpty()){
					IDs = this.value;
				}else{
					IDs += "|" + this.value;
				}
			}
		});
		return IDs;
	}
/*]]>*/
	function FilterClick()
	{
		document.adminForm.submit();
	}
</script>

<div id="content-box">
	<div class="border">
		<div class="padding">
			<div id="toolbar-box">
				<div class="t"><div class="t"><div class="t"></div></div></div>
				<div class="m">
				<div class="toolbar" id="toolbar">
				<table class="toolbar" summary="">
				<tr>
					
					<td class="button" id="toolbar-cancel">
					<a href="javascript:;//Đóng" id="lnkClose" class="toolbar">
						<span class="icon-32-cancel" title="Đóng"></span>
						Đóng
					</a>
					</td>
					
                    <td class="button" id="toolbar-cancel">
                    <a href="javascript:void(0)" id="lnkConfig" class="toolbar">
                        <span class="icon-32-config" title="Chốt doanh số"></span>
                        Cấu hình
                    </a>
                    </td>
                    
                    <td class="button" id="toolbar-cancel">
                    <a href="javascript:;//Đóng" id="lnkSaveHistory" class="toolbar">
                        <span class="icon-32-archive" title="Chốt doanh số"></span>
                        Chốt doanh số
                    </a>
                    </td>
				</tr>
				</table>
				</div>
				<div class="header icon-48-langmanager">Quản lý cấp bậc và số PV của thành viên</div>
				<div class="clr"></div>
			</div>
			<div class="b"><div class="b"><div class="b"></div></div></div>
  		</div>
   		<div class="clr"></div>
		<div id="element-box">
			<div class="t"><div class="t"><div class="t"></div></div></div>
			<div class="m">
			<form action="<?php echo DOMAIN?>/incomes/search" method="post" name="adminForm" id="adminForm">
			<table summary="">
			<tr>
				<td width="90%">
					Lọc:
					<input type="text" name="keyword" id="txtFilter"  class="text_area" size="60" style="height:18px;" onchange="this.form.submit();" />
					<button name="btnFilter" id="btnFilter">Tìm</button>
					<!--<button name="btnReset" id="btnReset">Làm lại</button>-->
				</td>
				<!--td width="10%">
					<?php echo $form->select('category_id',$categorylist, null,array('empty'=>'-- Danh mục gốc --','id'=>'ddlParent','onchange'=>'document.adminForm.submit();'));?>
				</td -->
			</tr>
			</table>

			<table class="adminlist" cellpadding="1" summary="">
			<thead>
				<tr>
					<th width="2%" class="title">#</th>
					
					<th width="10%" class="title">
						Họ tên 
					</th>
					<th width="7%" class="title" >
						Tài khoản
					</th>
                    <th width="" class="title" >
                        Cấp bậc hiện tại
                    </th>
                    <th width="" class="title" >
                        Tổng thành tích cá nhân tích tũy từ khi ra nhập
                    </th>
                    <th width="" class="title" >
                        Thành tích cá nhân(Thiếu theo cấp bậc hiện tại)
                    </th>
                    <th width="" class="title" >
                        Thành tích nhóm(Thiếu theo cấp bậc hiện tại)
                    </th>
                  <!--  <th width="10%" class="title" >
						Cấp trên 
					</th>
                    <th width="7%" class="title" nowrap="nowrap">
						Tài khoản cấp trên
					</th> -->
                    <th width="5%" class="title" >
						Chứng minh thư nhân dân
					</th>
                     <th width="5%" class="title" >
						Điện thoại
					</th>
                     <th width="15%" class="title" >
						Địa chỉ
					</th>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<td colspan="10">
						<del class="container"><div class="pagination"><div class="limit">
                        	 <?php


								$paginator->options(array('url' => $this->passedArgs));
								echo $paginator->first('first');echo "&nbsp;&nbsp;&nbsp;";
								echo $paginator->prev('Back', null, null, array('class' => 'disabled'));echo "&nbsp;&nbsp;&nbsp;";
								echo $paginator->numbers();echo "&nbsp;&nbsp;&nbsp;";
								echo $paginator->next('Next' , null, null, array('class' => 'disabled'));echo "&nbsp;&nbsp;&nbsp;";
								echo $paginator->last('last');
								echo "</span>";
					     	?>
                        </div><div class="limit"></div></div></del>
					</td>
				</tr>
			</tfoot>
			<tbody>
				<?php foreach($members as $key=>$member) { ?>
				<tr class="row0">
					<td align="center"><?php $i=$key +1; echo $i?></td>
					
					<td>
						<a href="<?php echo DOMAIN?>/incomes/view/<?php echo $member['Member']['id'] ?>"><?php echo $member['Member']['name']?></a>
					</td>
					<td align="center">
						<a href="<?php echo DOMAIN?>/incomes/view/<?php echo $member['Member']['id'] ?>"><?php echo $member['Member']['user']?></a>
					</td>
                    <td align="center">
                        <?php echo $namesOfLevel[$nodes[$member['Member']['id']]['levels']];?>
                    </td>
                    <td align="center">
                        <?php echo $nodes[$member['Member']['id']]['total_personal_pv'];?>
                    </td>
                    <td align="center">
                        <?php echo $nodes[$member['Member']['id']]['personal_pv'];?> (<?php echo $nodes[$member['Member']['id']]['missing_personal_pv'];?>)
                    </td>
                    <td align="center">
                        <?php echo $nodes[$member['Member']['id']]['group_pv'];?> (<?php echo $nodes[$member['Member']['id']]['missing_group_pv'];?>)
                    </td>

                  <!--  <td align="center">
						<?php //echo $member['ParentCat']['name']?>
					</td>
                    <td align="center">
						<?php //echo $member['ParentCat']['user']?>
					</td>-->
                     <td align="center">
						<?php echo $member['Member']['passport']?>
					</td>
					<td align="center">
						<?php echo $member['Member']['mobile']?>
					</td>
					<td><?php echo $member['Member']['add']?></td>
					</tr>
				<?php  }?>
			</tbody>
			</table>
			
			</form>
			<div class="clr"></div>
			</div>
			<div class="b"><div class="b"><div class="b"></div></div></div>
   		</div>
		<noscript>Warning! JavaScript must be enabled for proper operation of the Administrator back-end.</noscript>
		<div class="clr"></div>
	</div>
	<div class="clr"></div>
	</div>
</div>

